# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_gemname=minitest-power_assert
pkgname=ruby-${_gemname}
pkgver=0.3.1
pkgrel=1
pkgdesc='Power Assert for Minitest'
url='https://github.com/hsbt/minitest-power_assert'
arch=('any')
license=('custom:BSDL')
depends=('ruby' 'ruby-minitest' 'ruby-power_assert')
makedepends=('ruby-rdoc' 'ruby-rake' 'ruby-bundler')
options=('!emptydirs')
source=(${url}/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.gz)
sha512sums=('96b3d8c1899960a6d035b1de5fde5aba1235b89b7d11e416938269144532eb37afda0fa5896825b3bd74685cebb39fe43b39b9e4714212a7fdb28c396b886666')
b2sums=('7c2e687f572fb5d25203cdd1448052c6f380ba5f112c87fbb768416039f743869a23518c6d31d530eabfb1599e1c82f70b022a9f6c88bc16cf4ac8e1ea093176')

prepare() {
  cd ${_gemname}-${pkgver}
  sed 's|git ls-files -z|find -type f -print0\|sed "s,\\\\./,,g"|' -i ${_gemname}.gemspec
  sed -r 's|~>|>=|g' -i ${_gemname}.gemspec
}

build() {
  cd ${_gemname}-${pkgver}
  gem build ${_gemname}.gemspec
}

check() {
  cd ${_gemname}-${pkgver}
  rake test
}

package() {
  cd ${_gemname}-${pkgver}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" \
    -n "${pkgdir}/usr/bin" ${_gemname}-${pkgver}.gem
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
  rm -r "${pkgdir}/${_gemdir}/cache"
}

# vim: ts=2 sw=2 et:
